package com.heima;

public abstract class Animal {
    public int age = 10;

    public void etc() {
        System.out.println("猫在吃饭");
    }
}

class Dog extends Animal {
    public int age = 11;

    public void etc() {
        System.out.println("狗在吃饭");
    }

    public static void main(String[] args) {
        Animal animal = new Dog();
        Dog d = (Dog) animal;
        animal.etc();
        System.out.println(animal.age);
        d.etc();
    }
}


